package state.pattern;

/**
 * @author ZLL
 * @date create in 2018/05/10
 */
public class RestrictedState extends AccountState {

    public RestrictedState(AccountState accountState) {
        this.account = accountState.account;
    }

    @Override
    public void stateCheck() {
        if(account.getBalance() > 0){
            account.setState(new NormalState(this));
        }else if(account.getBalance() > -2000){
            account.setState(new OverState(this));
        }
    }

    @Override
    protected void withDraw(double amount) {
        System.out.println("受限状态，取款失败。。。");
    }

    @Override
    void computeInterest() {
        System.out.println("受限状态要收利息。。。");
    }
}
